<?php
error_reporting(E_ALL);

//error_reporting(E_ALL || ~E_NOTICE);
session_start();

include('bin/kp.config.php');
define('TEMPLATE','template/');
$t = '';
$para = array();
$para = $GLOBALS['website']['para'];
if(!count($para) > 0)
	$t = TEMPLATE.'index.tpl';	
else
{
	if($para[0] == 'activity' || $para[0] == 'promotion' || $para[0] == 'coupon')
	{
		$backUrl = '';
		foreach($para as $u)
		{
			$backUrl .= '/' . $u;
		}
		$_SESSION['backUrl'] = $backUrl;
		if(isset($para[1]))
		{
			if($para[1] == 'details')
				$t = TEMPLATE .'showgoods.tpl';	
			else
				$t = TEMPLATE .'goods.tpl';
		}
		else
		{
			$t = TEMPLATE .'goods.tpl';
		}
	}	
	else
	{		
		if(isset($para[1]))
		{
			if($para[1] == 'details')
				$t = TEMPLATE .'show'.$para[0].'.tpl';	
			else
				$t = TEMPLATE .$para[0].'.tpl';
		}
		else
		{
			$t = TEMPLATE .$para[0].'.tpl';
		}
	}	
	if($para[0] == 'chkcode')
	{
		include('bin/kp.validate.php');
		$code = new validate;
		$code -> doimg();
		$_SESSION['chkcode'] = $code->getCode();
		exit;
	}
}
if(!file_exists($t))
{	
	$core->GetError();
}	
//unset($_SESSION['shopcar']);
//echo array_search('21062',$_SESSION['shopcar'],true);
$p = new init;
$p->tpl = $t;
$p->para = $para;
$p->load();

?>